package com.ct.controller;

import java.util.List;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ct.entity.po.ReimbursementApprovalMa;
import com.ct.entity.query.ReimbursementApprovalMaQuery;
import com.ct.entity.vo.ResponseVO;
import com.ct.service.ReimbursementApprovalMaService;

import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotEmpty;

/**
 * 经理审批报销申请记录 Controller
 */
@RestController("reimbursementApprovalMaController")
@RequestMapping("/reimbursementApprovalMa")
public class ReimbursementApprovalMaController extends ABaseController {

    @Resource
    private ReimbursementApprovalMaService reimbursementApprovalMaService;

    /**
     * 根据条件分页查询
     */
    @RequestMapping("/loadDataList")
    public ResponseVO loadDataList(ReimbursementApprovalMaQuery query) {
        return getSuccessResponseVO(reimbursementApprovalMaService.findListByPage(query));
    }

    /**
     * 新增
     */
    @RequestMapping("/add")
    public ResponseVO add(ReimbursementApprovalMa bean) {
        reimbursementApprovalMaService.add(bean);
        return getSuccessResponseVO(null);
    }

    /**
     * 批量新增
     */
    @RequestMapping("/addBatch")
    public ResponseVO addBatch(@RequestBody List<ReimbursementApprovalMa> listBean) {
        reimbursementApprovalMaService.addBatch(listBean);
        return getSuccessResponseVO(null);
    }

    /**
     * 批量新增/修改
     */
    @RequestMapping("/addOrUpdateBatch")
    public ResponseVO addOrUpdateBatch(@RequestBody List<ReimbursementApprovalMa> listBean) {
        reimbursementApprovalMaService.addBatch(listBean);
        return getSuccessResponseVO(null);
    }

    /**
     * 根据ReimbursementApprovalMaId查询对象
     */
    @RequestMapping("/getReimbursementApprovalMaByReimbursementApprovalMaId")
    public ResponseVO getReimbursementApprovalMaByReimbursementApprovalMaId(Integer reimbursementApprovalMaId) {
        return getSuccessResponseVO(reimbursementApprovalMaService
                .getReimbursementApprovalMaByReimbursementApprovalMaId(reimbursementApprovalMaId));
    }

    /**
     * 根据ReimbursementApprovalMaId修改对象
     */
    @RequestMapping("/updateReimbursementApprovalMaByReimbursementApprovalMaId")
    public ResponseVO updateReimbursementApprovalMaByReimbursementApprovalMaId(ReimbursementApprovalMa bean,
            Integer reimbursementApprovalMaId) {
        reimbursementApprovalMaService.updateReimbursementApprovalMaByReimbursementApprovalMaId(bean,
                reimbursementApprovalMaId);
        return getSuccessResponseVO(null);
    }

    /**
     * 根据ReimbursementApprovalMaId删除
     */
    @RequestMapping("/deleteReimbursementApprovalMaByReimbursementApprovalMaId")
    public ResponseVO deleteReimbursementApprovalMaByReimbursementApprovalMaId(Integer reimbursementApprovalMaId) {
        reimbursementApprovalMaService
                .deleteReimbursementApprovalMaByReimbursementApprovalMaId(reimbursementApprovalMaId);
        return getSuccessResponseVO(null);
    }

    /**
     * 分页查询报销审批记录
     * 
     * @param userId   工号
     * @param pageNo   页码
     * @param pageSize 页大小
     * @return 分页结果
     */
    @RequestMapping("/getApproveReimbursementRecordMa")
    public ResponseVO getApproveReimbursementRecordMa(@NotEmpty String userId, Integer pageNo, Integer pageSize) {
        return getSuccessResponseVO(
                reimbursementApprovalMaService.getApproveReimbursementRecordMa(userId, pageNo, pageSize));
    }

    @RequestMapping("/getReimbursementApprovalMaByReimbursementId")
    public ResponseVO getReimbursementApprovalMaByReimbursementId(@RequestParam Integer reimbursementId) {
        return getSuccessResponseVO(
                reimbursementApprovalMaService.getReimbursementApprovalMaByReimbursementId(reimbursementId));
    }
}